package zero.tech.games.log.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Select;

import zero.tech.games.entity.log.LogGoldChange;

public interface LogGoldChangeMapper {

	void insertBatch(List<LogGoldChange> list);

	@Select("select count(1) from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end}")
	int totalCount(int uid,int club_id,Date begin,Date end);

	@Select("select * from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} order by create_stamp desc limit #{start},#{pageLength}")
	List<LogGoldChange> findLogGoldChangeByPage(int uid,int club_id, int start, int pageLength,Date begin,Date end);

	@Select("select count(1) from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type in (1002,1003,1004,1005)")
	int totalCountByChuru(int uid, int club_id, Date begin, Date end);

	@Select("select * from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type in (1002,1003,1004,1005) order by create_stamp desc limit #{start},#{pageLength}")
	List<LogGoldChange> findLogGoldChangeChuruByPage(int uid, int club_id, int start, int pageLength, Date begin,
			Date end);
	@Select("select count(1) from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type=1001 ")
	int totalCountByShuying(int uid, int club_id, Date begin, Date end);

	@Select("select * from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type=1001 order by create_stamp desc limit #{start},#{pageLength}")
	List<LogGoldChange> findLogGoldChangeShuyingByPage(int uid, int club_id, int start, int pageLength, Date begin,
			Date end);
	
	@Select("select count(1) from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type in (1007,1008) ")
	int totalCountByChayeku(int uid, int club_id, Date begin, Date end);

	@Select("select * from log_gold_change where club_id=#{club_id} and uid=#{uid} and create_stamp between #{begin} and #{end} and change_type in (1007,1008) order by create_stamp desc limit #{start},#{pageLength}")
	List<LogGoldChange> findLogGoldChangeChayekuByPage(int uid, int club_id, int start, int pageLength, Date begin,
			Date end);

}
